<?php

namespace App\Service\Push;

use App\Service\BaseService;

/**
 * 推送，基础任务的sql获取 - 底层抽象
 */
abstract class PushAbstractFuncService extends BaseService
{
    protected int $task;

    /**
     * @param int $task
     */
    public function setTask(int $task): self
    {
        $this->task = $task;
        return $this;
    }

    /**
     * 通用返回
     * @param string $functionName
     * @param int $userId
     * @param int $createdAt
     * @param string $uuid
     * @return array
     */
    protected function taskResponse(int $userId, int $createdAt, string $uuid): array
    {
        return [
            'task'      => $this->task,
            'taskName'  => PushConfigService::ENUM_TEXT[$this->task] ?? '-',
            'userId'    => $userId,
            'createdAt' => $createdAt,
            'uuid'      => $uuid,
        ];
    }
}
